{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "56859574",
   "metadata": {},
   "outputs": [],
   "source": [
    "F=GF(31)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "af39df20",
   "metadata": {},
   "outputs": [],
   "source": [
    "def x2y(x):\n",
    "    a = F(x)\n",
    "    b = F(1)-a*a\n",
    "    return b\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "f05141f5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x2y(4).nth_root(22)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "766929ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "m = matrix([[F(4),F(4)],[F(-4),F(4)]])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "f6a89cec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[ 4  4]\n",
       "[27  4]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "1de9dfc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[ 0  1]\n",
       "[30  0]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m*m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "fb3427cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1 0]\n",
       "[0 1]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m.transpose()*m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0e2e6734",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "SageMath 9.2",
   "language": "sage",
   "name": "sagemath"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
